// import com.alibaba.druid.sql.ast.statement.SQLCreateTableStatement;
// import com.alibaba.druid.sql.ast.statement.SQLTableSourceImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

#include "../../sql/ast/SQLAdhocTableSource.h"
#include "../../sql/ast/statement/SQLCreateTableStatement.h"
#include "../../sql/ast/statement/SQLTableSourceImpl.h"
#include "../../sql/visitor/SQLASTVisitor.h"

SQLAdhocTableSource::SQLAdhocTableSource(std::shared_ptr<SQLCreateTableStatement> definition)
{
  setDefinition(definition);
}

//@Override
void SQLAdhocTableSource::accept0(SQLASTVisitor_ptr v)
{
  if (v->visit(SharedObject(SQLAdhocTableSource)))
  {
    if (definition != nullptr)
    {
      definition->accept(v);
    }
  }
  v->endVisit(SharedObject(SQLAdhocTableSource));
}

std::shared_ptr<SQLCreateTableStatement> SQLAdhocTableSource::getDefinition()
{
  return definition;
}

void SQLAdhocTableSource::setDefinition(std::shared_ptr<SQLCreateTableStatement> x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLAdhocTableSource));
  }
  this->definition = x;
}
